package com.ceair.flight.refund.service.mailAndSms;

import com.alibaba.fastjson.JSON;
import com.ceair.muservice.common.constant.QueueName;
import com.ceair.muservice.common.dto.queue.MailAndSMSMessage;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service("mailAndSMSMessageProducer")
public class MailAndSMSMessageProducer {
    @Resource
    private AmqpTemplate amqpTemplate;

    public void sendMessage(MailAndSMSMessage message) {
        amqpTemplate.convertAndSend(QueueName.MAIL_AND_SMS, JSON.toJSONString(message));
    }
}
